/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#ifndef MK_PS_PACKET_H
#define MK_PS_PACKET_H
#include "MkMedia/MkMediaUtil.h"
#include "MkUtil/MkBuffer.h"

class MkApi CMkPsMuxer
{
public:
    static Uint32 PacketEsPacket(const CMkVideoParam& VideoParam, const CMkAudioParam& AudioParam, const MkEsPacket& EsPacket, Uint8* pBuf, Uint32 nLen, Uint32& nUsed, CMkBufferList& ReBufferList);
protected:
    static Uint32 PacketPsHeader(const CMkVideoParam& VideoParam, const CMkAudioParam& AudioParam, Uint32 Pts, Uint8* pBuf, Uint32 nLen, Uint32& nUsed, CMkBufferList& ReBufferList);
    static Uint32 PacketPes(const CMkVideoParam& VideoParam, const CMkAudioParam& AudioParam, const Uint8* pData, Uint32 nDataLen, Uint8* pBuf, Uint32 nLen, Uint32& nUsed, const MkCodecType& CodecType, BOOL bAppendPes, Uint32 Pts, Uint32 Dts, CMkBufferList& ReBufferList);
    static Uint32 PacketPsMap(const CMkVideoParam& VideoParam, const CMkAudioParam& AudioParam, Uint8* pBuf, Uint32 nLen, Uint32& nUsed, CMkBufferList& ReBufferList);
    static Uint32 PacketPsSystem(const CMkVideoParam& VideoParam, const CMkAudioParam& AudioParam, Uint8* pBuf, Uint32 nLen, Uint32& nUsed, CMkBufferList& ReBufferList);
};


#endif